package com.bt.lms.ui.page.first;

import com.bt.lms.ui.vo.PageSkipInfo;
import com.bt.lms.ui.page.first.action.PassSetLabMC;
import com.bt.lms.ui.page.sys.utils.MyHBox;
import com.bt.lms.ui.page.sys.utils.MyVBox;
import com.bt.lms.ui.page.sys.style.LabStyle;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;

/**
 * 个人中心界面
 */
public class OneselfMes extends VBox {


    /**
     * 构建界面
     * @param pageSkipInfo 界面跳转数据
     */
    public OneselfMes(PageSkipInfo pageSkipInfo){


        //布局
        Insets insets = new Insets(10);
        this.setPadding(insets);
        this.setSpacing(10);

        //组件(定位区域)
        MyHBox locationHBox = new MyHBox();
        locationHBoxInit(locationHBox);
        this.getChildren().add(locationHBox);

        //组件（输入区域）
        MyVBox inputVBox = new MyVBox();
        inputVBoxInit(inputVBox);
        this.getChildren().add(inputVBox);

    }

    /**
     * 输入区域初始化
     * @param inputVBox 输入区域
     */
    private void inputVBoxInit(MyVBox inputVBox) {

        //布局
        Insets insets = new Insets(10);
        inputVBox.setPadding(insets);
        inputVBox.setSpacing(10);

        //组件（定位说明
        Label locationLab = new Label("基本信息");
        inputVBox.getChildren().add(locationLab);

        //组件（网格输入区）
        GridPane gridPane = new GridPane();
        gridPaneInit(gridPane);
        inputVBox.getChildren().add(gridPane);
    }

    /**
     * 基本信息输入区初始化
     * @param gridPane 输入区
     */
    private void gridPaneInit(GridPane gridPane) {

        //布局
        Insets insets = new Insets(10, 20, 10, 60);
        gridPane.setPadding(insets);
        gridPane.setVgap(10);
        gridPane.setHgap(15);


        //组件
        Label eMailLab = new Label("账号：");
        gridPane.add(eMailLab,0,1);
        GridPane.setHalignment(eMailLab, HPos.RIGHT);
        Label eMailDataLab = new Label("dongsan@126.com");
        gridPane.add(eMailDataLab,1,1);

        Label nameLab = new Label("用户姓名：");
        gridPane.add(nameLab,0,2);
        GridPane.setHalignment(nameLab, HPos.RIGHT);
        Label nameDataLab = new Label("董三");
        gridPane.add(nameDataLab,1,2);

        Label idTypeLab = new Label("证件类型：");
        gridPane.add(idTypeLab,0,3);
        GridPane.setHalignment(idTypeLab, HPos.RIGHT);
        Label idTypeDataLab = new Label("身份证");
        gridPane.add(idTypeDataLab,1,3);

        Label idLab = new Label("证件号码：");
        gridPane.add(idLab,0,4);
        GridPane.setHalignment(idLab, HPos.RIGHT);
        Label idDataLab = new Label("130703198509280619");
        gridPane.add(idDataLab,1,4);

        Label unitLab = new Label("所属单位：");
        gridPane.add(unitLab,0,5);
        GridPane.setHalignment(unitLab, HPos.RIGHT);
        Label unitDataLab = new Label("博添");
        gridPane.add(unitDataLab,1,5);

        Label phoneLab = new Label("移动电话：");
        gridPane.add(phoneLab,0,6);
        GridPane.setHalignment(phoneLab, HPos.RIGHT);
        Label phoneDataLab = new Label("13221223421");
        gridPane.add(phoneDataLab,1,6);

        Label passSetLab = new Label("修改密码");
        gridPane.add(passSetLab,1,7);
        //事件(鼠标点击)
        PassSetLabMC passSetLabMC = new PassSetLabMC(this,gridPane);
        passSetLab.setOnMouseClicked(passSetLabMC);

    }


    /**
     * 定位区域初始化
     * @param locationHBox 定位区域
     */
    private void locationHBoxInit(MyHBox locationHBox) {

        //控制数据
        int height = 42;

        //大小
        locationHBox.setPrefHeight(height);

        //布局
        Insets insets = new Insets(5);
        locationHBox.setPadding(insets);
        locationHBox.setSpacing(0);
        locationHBox.setAlignment(Pos.CENTER_LEFT);

        //组件
        Label siteLab = new Label("当前位置：");
        LabStyle.notWeight(siteLab);//不重要（颜色浅）
        LabStyle.locationSize(siteLab);//位置样式

        Label label = new Label("🏠");
        LabStyle.notWeight(label, 0.3);
        LabStyle.locationSize(label);

        Label oneCatalogLab = new Label(">个人信息管理");
        LabStyle.notWeight(oneCatalogLab);
        LabStyle.interaction(oneCatalogLab);
        LabStyle.locationSize(oneCatalogLab);

        //添加组件
        locationHBox.getChildren().addAll(siteLab, label, oneCatalogLab);

    }
}
